package com.crosbymichael.filesystem
{
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;

	/**
	 * Writes the path to the Air SDK's adt in the application storage directory for
	 * reference on later uses.
	 *   
	 * @author Michael Crosby crosbymichael.com
	 * 
	 */	
	public class WriteSDKPath
	{
		public function WriteSDKPath()
		{
		}
		
		/**
		 * Writes the nativePath string to a file. 
		 * 
		 * @param path The nativePath of the SKD adt file.
		 * 
		 */		
		public function writePath(path:String):void {
			var sdkFile:File = new File(path);
			//Quick final validation that they path does exist
			if (sdkFile.exists) {
				var f:File = File.applicationStorageDirectory.resolvePath("sdkpath");
				var fs:FileStream = new FileStream();
				
				fs.open(f, FileMode.WRITE);
				fs.writeUTFBytes(path);
				fs.close();
			}
		}
	}
}